-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[enhance](iceberg) Refactor Iceberg metadata cache structure and add table cache test cases #59716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run external |
|
run buildall |
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 32189 ms |
TPC-DS: Total hot run time: 173580 ms |
FE Regression Coverage ReportIncrement line coverage |
| lastedIcebergSnapshot.getSnapshotId()); | ||
| try { | ||
| MTMVRelatedTableIf table = (MTMVRelatedTableIf) dorisTable; | ||
| IcebergSnapshot lastedIcebergSnapshot = IcebergUtils.getLastedIcebergSnapshot(dorisTable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here is a bit convoluted. We reach this point via the TableCache, so we have already obtained an IcebergTable instance. However, IcebergUtils.getLatestIcebergSnapshot goes back to the TableCache again to fetch the IcebergTable.
| @@ -55,9 +54,7 @@ public class IcebergMetadataCache { | |||
| private static final Logger LOG = LogManager.getLogger(IcebergMetadataCache.class); | |||
| private final ExecutorService executor; | |||
| private final IcebergExternalCatalog catalog; | |||
| private LoadingCache<IcebergMetadataCacheKey, List<Snapshot>> snapshotListCache; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not used before?
What problem does this PR solve?
Description
Changes
This PR refactors the Iceberg metadata cache structure to improve code organization and adds comprehensive test cases for table cache behavior.
Main Changes
1. Refactored IcebergMetadataCache
IcebergTableCacheValueto encapsulate table-related metadatasnapshotListCacheandsnapshotCacheIcebergTableCacheValuewith lazy loadingtableCacheandviewCacheBefore:
After:
2. Lazy Loading for Snapshot Cache
IcebergTableCacheValue.getSnapshotCacheValue()3. Simplified Cache API
getIcebergTable(): Returns the Table object directly fromIcebergTableCacheValuegetSnapshotCache(): Returns snapshot cache value with lazy loadinggetSnapshotList(): Returns snapshot list from the Table object4. Test Cases
test_iceberg_table_cacheto verify cache behaviorBenefits
IcebergTableCacheValueinstead of multiple separate cachesTest Results
test_iceberg_table_cache.groovyREFRESH TABLERelated Files
Core Changes:
IcebergMetadataCache.java- Refactored cache structureIcebergTableCacheValue.java- New class to encapsulate table metadataIcebergExternalCatalog.java- Updated cache-related configurationsTests:
test_iceberg_table_cache.groovy- Comprehensive cache behavior testsSuite.groovy- UpdatedgetSparkIcebergContainerName()implementationCheck List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)